package com.micro.modual.controller;

import com.micro.core.resp.RespJson;
import com.micro.core.resp.RespJsonData;
import com.micro.core.resp.RespJsonPageData;
import com.micro.modual.model.bo.refundorder.RefundOrderBO;
import com.micro.modual.model.dto.refundorder.RefundOrderDetailDTO;
import com.micro.modual.model.dto.refundorder.RefundOrderListDTO;
import com.micro.modual.service.RefundOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;

import java.util.Map;

/**
 * <h1>退款订单记录表 控制器</h1>
 * @author levelcoder
 * @version V1.0.0
 * @email LevelCoder@126.com
 * @date 2020-08-04 00:27:47
 */
@Api(value = "退款管理",tags = "退款管理")
@RestController
@RequestMapping(value = "refundOrder")
public class RefundOrderController {

    @Autowired
    private RefundOrderService refundOrderService;

    /**
     * <h2>查找退款订单记录表 列表</h2>
     * @param params 列表查询请求对象
     * @return List<RefundOrderListDTO> {@link RefundOrderListDTO}s  退款订单记录表 列表返回对象
     */
    @ApiOperation(value = "查询退款订单记录表列表" ,notes = "查询退款订单记录表列表")
    @GetMapping(value = "/findRefundOrderList")
    public RespJsonPageData<RefundOrderListDTO> findRefundOrderList(@RequestParam  Map<String,Object> params){
        return refundOrderService.findList(params,RefundOrderListDTO.class);
    }

    /**
     * <h2>根据主键编号查看退款订单记录表详情</h2>
     * @param id  退款订单记录表 主键编号
     * @return {@link RefundOrderDetailDTO}  退款订单记录表 详情
     */
    @ApiOperation(value = "查询退款订单记录表详情",notes = "根据主键编号，查询退款订单记录表详情")
    @GetMapping(value = "/findRefundOrderDetail/{id}")
    public RespJsonData<RefundOrderDetailDTO> findRefundOrderDetail(@PathVariable("id") Long id){
        return refundOrderService.findDetail(id,RefundOrderDetailDTO.class);
    }

    /**
     * <h2>新增退款订单记录表详情</h2>
     * @param refundOrderBO {@link RefundOrderBO} 退款订单记录表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "新增退款订单记录表",notes = "新增退款订单记录表")
    @PostMapping(value = "/addRefundOrder")
    public RespJson addRefundOrder(@RequestBody RefundOrderBO refundOrderBO){
        return refundOrderService.addRefundOrder(refundOrderBO);
    }

    /**
     * <h2>修改退款订单记录表详情</h2>
     * @param refundOrderBO  {@link RefundOrderBO} 退款订单记录表 新增/修改 请求对象
     * @return {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "修改退款订单记录表",notes = "修改退款订单记录表")
    @PostMapping(value = "/editRefundOrder")
    public RespJson editRefundOrder(@RequestBody RefundOrderBO refundOrderBO){
        return refundOrderService.editRefundOrder(refundOrderBO);
    }

    /**
     * <h2>根据主键编号删除退款订单记录表信息</h2>
     * @param id  退款订单记录表 主键编号
     * @return  {@link RespJson} 返回结果基础类
     */
    @ApiOperation(value = "删除退款订单记录表",notes = "根据地址ID，删除退款订单记录表")
    @PostMapping(value = "/deleteRefundOrder/{id}")
    public RespJson deleteRefundOrder(@PathVariable("id") Long id){
        return refundOrderService.deleteRefundOrder(id);
    }
}

